home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Run Magazine ReRun 1991 January & February
/
rerun-1991-01-02.d64
/
laser math
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
3KB
|
90 lines
10 rem---laser math - tony brantner
20 poke53280,0:poke53281,0:printchr$(8)chr$(142)
30 dimml(1,11),hi(4),an(3)
40 fora=0to1:forz=0to11:readml(a,z):next:next
50 tc=646:s1=54272:s2=s1+7:a=rnd(-ti)
60 tt$="[180][146][164][164]aser [180][146][205][206][161]ath":fora=1to38:sp$=sp$+" ":next
70 fora=s1tos1+23:pokea,0:next:pokes1+24,15:gosub740:ht=0:ms=0
80 rem---new wave
90 print"[147]"tab(2)"[159]level"lv+1;tab(12)tt$;tab(31)"[159]speed"gs
100 cx=1:fora=1to4:cy=20+a:gosub480:print""mid$("[158][154]",a,1)sp$;:next
110 poketc,2:cy=21:forcx=4to34step10:gosub480:print"[162][162]":next
120 printtab(14)"[158]answer[182]":printtab(2)"hits [146] ";tab(27)"misses [146] "
130 pn=0:fora=0to4:hi(a)=0:next:poke198,0
140 rem---new entry
150 mc=99:in$="":cy=22:cx=21:gosub480:print" "
160 print""tab(13-len(str$(ht)))ht;tab(38-len(str$(ms)))ms
170 ifpn=20andht/20=int(ht/20)then360
180 rem---main
190 cy=22:cx=21+len(in$):gosub480:print"[209]"
200 mc=mc+1:ifmc<20thenfora=1to70:next:goto240
210 mc=gs*2:ifpn<20thenln=int(rnd(1)*4):ifhi(ln)=0thengosub540
220 gosub500:z=0:fora=0to3:ifhi(a)thenhi(a)=hi(a)+1:ifhi(a)>17thenz=1
230 next:ifzthen400
240 cy=22:cx=21+len(in$):gosub480:print" [157]";:geta$:z=len(in$)
250 ifa$=chr$(13)andzthen300
260 ifa$=chr$(20)andzthenin$=left$(in$,z-1):print"[157] ":goto190
270 ifa$<"0"ora$>"9"orz>3then190
280 in$=in$+a$:printa$:goto190
290 rem---check answer
300 ln=4:fora=0to3:ifhi(a)=0oran(a)<>val(in$)then320
310 ifhi(a)>hi(ln)thenln=a
320 next:ifln<4thengosub650:ht=ht+1:hi(ln)=0:goto150
330 pokes1+6,240:pokes1+1,6:pokes1+4,33:fora=1to200:next:pokes1+4,32
340 ms=ms+1:goto150
350 rem---advance
360 pokes1+6,248:pokes1+4,17:fora=1to12:pokes1+1,a*8:forz=1to70:next:next
370 pokes1+4,16:ifgs<9thengs=gs+1
380 z$="press any key to advance":gosub440:goto90
390 rem---end
400 pokes1+6,248:pokes1+4,33:fora=45to1step-.1:pokes1+1,a:next
410 pokes1+4,32:a=ht*2-ms:ifa<0thena=0
420 z$="final score:"+str$(a)+" - press any key":gosub440:goto70
430 rem---get key
440 cy=2:cx=(40-len(z$))/2:a=0:z=0:poke198,0
450 gosub480:poketc,4+z*3:printleft$(z$,a):a=a+1:ifa>len(z$)thena=0:z=1-z
460 geta$:on-(a$="")goto450:return
470 rem---plot
480 poke214,cy-1:print:printtab(cx);:return
490 rem---scroll
500 poke781,3:poke782,248:poke91,218:poke90,40:poke89,218:poke88,80
510 sys41964:poke781,3:poke782,248:poke91,6:poke90,40:poke89,6:poke88,80
520 sys41964:return
530 rem---new saucer
540 a=ml(ma/2,lv*4):n1=a+int(rnd(1)*(ml(ma/2,lv*4+1)-a+1))
550 a=ml(ma/2,lv*4+2):n2=a+int(rnd(1)*(ml(ma/2,lv*4+3)-a+1))
560 ifma=0thenan(ln)=n1+n2
570 ifma=1thena=n1+n2:an(ln)=n1:n1=a
580 ifma=2thenan(ln)=n1*n2
590 ifma=3thena=n1*n2:an(ln)=n2:n2=n1:n1=a
600 cx=1+ln*10:poketc,rnd(1)*13+2:print""tab(cx)left$(sp$,8)
610 printtab(cx)" [164][175][185][185][175][164] ":printtab(cx)"[206]"spc(6)"[205]":printtab(cx)"[163][183][184][178][178][146][184][183][163]"
620 print"[145][145]"tab(cx+1)right$(str$(n1),3)mid$("+-*/",ma+1,1)mid$(str$(n2),2)
630 hi(ln)=2:pn=pn+1:return
640 rem---explode
650 cy=20:cx=4+ln*10:gosub480:poketc,7:pokes1+6,240:pokes1+4,33
660 fora=20tohi(ln)+1step-1:pokes1+1,a*8:print"[172][187][145][157][157]";:next:pokes1+4,32
670 pokes2+5,26:pokes2+6,9:pokes2+4,128:pokes2+4,129:cy=hi(ln):cx=1+ln*10
680 fora=2to7:pokes2+1,40-a*4:gosub480:poketc,a
690 print" [201][205][206][213] ":printtab(cx)"-[195] [214][214] [195]-":printtab(cx)" [203][206][205][202] ":next
700 poke214,cy-1:print:fora=1to3:printtab(cx)left$(sp$,8):next
710 cy=20:cx=4+ln*10:gosub480
720 fora=20tohi(ln)+1step-1:print" [145][157][157]";:next:return
730 rem---menu
740 print"[147]":cy=4:cx=12:gosub480:printtt$
750 cy=8:cx=8:gosub480:print"[150]select operation (1-4)"
760 print:printtab(11)"1 addition":printtab(11)"2 subtraction"
770 printtab(11)"3 multiplication":printtab(11)"4 division":cx=31:gosub480
780 z$="4":gosub840:ma=a-1
790 cy=16:cx=7:gosub480:print"[154]select skill level (1-3) ";
800 z$="3":gosub840:lv=a-1
810 cy=19:cx=6:gosub480:print"[153]select starting speed (1-9) ";
820 z$="9":gosub840:gs=a:return
830 rem---get number
840 poke198,0:poketc,1
850 print"[209][157]";:fora=1to50:next:print" [157]";:fora=1to50:next
860 geta$:ifa$<"1"ora$>z$then850
870 printa$:fora=1to300:next:a=val(a$):return
880 rem---level data
890 data1,9,1,9,10,20,10,20,50,99,50,99,1,4,1,12,5,8,3,12,9,12,5,12